beginoutdoorscript;

variables;
short mound,holy,speres,wihcaser,gobbos,buyfood;

body;

beginstate 0;
break;

beginstate 1;
break;

beginstate START_STATE;
break;

beginstate 10;

	if(get_flag(2,1) == 53){
		message_dialog("The Holy Mound is across the river to the north.  Since you are on a holy mission, you have no choice but to visit the burial grounds of those Speres who came before you.","");
		block_entry(1);
	}
	if(get_flag(2,1) == 54){
		message_dialog("The guardposts are to the southeast.  You are going in the wrong direction.","");
		block_entry(1);
	}

break;

beginstate 11;

	message_dialog("There is a small village of the Emerald Tribe here.  Like your village on the mountain, this village is protected by brave Speres.","The people here are friendly, but unfortunately have no ways to help you in your quest.");
	block_entry(1);

break;

beginstate 12;

	if(get_flag(2,1) > 53){
		message_dialog("The Holy Mound is still here, but you have no reason to be.","Seeing how you have no business here, you back away.");
		block_entry(1);
		end();
	}

	if(get_flag(2,1) == 53){
		reset_dialog();
		add_dialog_str(0,"Pristine, granite stairs lead up to one of Emerald Valley's holiest locales, the Holy Mound.",0);
		add_dialog_str(1,"A sense of ominous, sacred import pervades your senses.  The spirits here are strong and many in number, almost palpably so.",0);
		add_dialog_str(2,"It is a rite among members of your tribe to pray at Holy Mound under the moonlight.  If you wish for success in your mission, then having the spirits on your side is of the utmost importance.",0);
		add_dialog_choice(0,"Pray to the Holy Mound.");
		add_dialog_choice(1,"Leave.");
		mound = run_dialog(1);
		if(mound == 2){
			block_entry(1);
			end();
		}
		else{
			while(get_current_tick() < 29500){
				set_ticks_forward(50);
			}
			force_instant_terrain_redraw();
			large_draw_pic_dialog(403,"You begin to pray.");
			reset_dialog();
			if(party_size() > 1){
				add_dialog_str(0,"With the sky darkened and the moon lighting the graves, you lie yourselves prostrate before the mound and wish for the blessings of the spirits.",0);
			}
			else{
				add_dialog_str(0,"With the sky darkened and the moon lighting the graves, you lie yourself prostrate before the mound and wish for the blessings of the spirits.",0);
			}
			add_dialog_str(1,"You remember back to your teachings from your youth.  You were taught three tenets which made the trinity of morality which guided you throughout your days.",0);
			add_dialog_str(2,"Honor, Tradition and Conviction.",0);
			add_dialog_str(3,"Tenets as unwavering as these should always lead to the same conclusion.  Why Wihcaser perceived ambiguity in these tenets is beyond you, but as you pray for guidance, you know what must be done.",0);
			add_dialog_str(4,"He has made the wrong choice.  His vision of the trinity of morality led him astray, and since evil perverted his vision of the moral trinity, if he decides to resist, then you must cut him down.",0);
			add_dialog_str(5,"He was a brother to you, and perhaps he still is.  Nevertheless, you owe yourselves to your tribe and its beliefs first, and him second.",0);
			add_dialog_choice(0,"Amen.");
			holy = run_dialog(1);
			message_dialog("You get up from your positions with a new-found sense of purpose.  First, though, you must check with the guardposts to the southeast.","Hopefully, Wihcaser has not yet left the valley.");
			set_flag(2,1,54);
			block_entry(1);
			end();
		}
	}

break;

beginstate 13;

	if(get_flag(2,1) == 53){
		message_dialog("The Holy Mound is right here, and you are going past it.  Since you are on a holy mission, you have no choice but to visit the burial grounds of those Speres who came before you.","");
		block_entry(1);
	}

break;

beginstate 14;

	if(get_flag(2,1) == 54){
		message_dialog("The guardposts are to the southeast.  You are going in the wrong direction.","");
		block_entry(1);
	}

break;

beginstate 15;

	if(get_flag(2,1) > 54){
		message_dialog("The Speres at the guardpost are still glad to see that you are well, but have no new ways to help you on your quest.","");
		block_entry(1);
		end();
	}
	if(get_flag(2,1) == 54){
		reset_dialog();
		add_dialog_str(0,"You call out to the Speres guarding the valley.  One of them climbs down and cordially asks you why you are here.",0);
		add_dialog_str(1,"After explaining what Wihcaser did at your village, the guards are shocked, but somewhat relieved.  _The robbery is awful, but we have good news for you._",0);
		add_dialog_str(2,"_Wihcaser did not leave the valley.  You can still retrieve the gem.  Where he went, we know not for sure, but still...",0);
		add_dialog_str(3,"_We saw a caped figure in the distance head down the road approaching us, but then it darted directly south shortly after coming into view._",0);
		add_dialog_str(4,"_If that was Wihcaser, I would look for him there.  Best of luck!_  The Spere returns to his post.",0);
		add_dialog_str(5,"Wihcaser has not left the valley, but has instead headed south.  You absolutely must chase him down.",0);
		add_dialog_choice(0,"Thank goodness!");
		speres = run_dialog(1);
		set_flag(2,1,55);
		block_entry(1);
		end();
	}
break;

beginstate 16;
	message_dialog("You can't leave the valley yet, you still have things left to do here!","");
	block_entry(1);
break;

beginstate 17;

	if(get_flag(2,1) < 60){
		message_dialog("You stumble upon a corpse in the hills, a corpse which you will never forget.","");
		large_draw_pic_dialog(402,"Wihcaser is dead.");
		reset_dialog();
		add_dialog_str(0,"He was brought down by a large weapon.  He has slice marks all over his body, and not thin ones either.",0);
		add_dialog_str(1,"Whoever slew him was clearly a powerful warrior with a powerful weapon at his command.",0);
		add_dialog_str(2,"Regretfully, you begin searching his body for the Aquos Gem.  After five minutes of searching, you conclude that it was taken from him when he was slain.",0);
		add_dialog_str(3,"You are in goblin territory.  Likely, the goblins stole his gem and took it up into the mountains to their ratty, piecemeal village.",0);
		if(reward_give(457) == 1){
			add_dialog_str(4,"Wihcaser's spear is powerful, and was not taken by the goblins.  You pick up the spear of your most beloved brother and set out to avenge him.",0);
			add_dialog_str(5,"Wihcaser was a sinner, but no man is perfect.  He was a friend to you, and he did not deserve this.  Honor, Tradition and Conviction ran strongly in him.",0);
		}
		else{
			add_dialog_str(4,"Wihcaser was a sinner, but no man is perfect.  He was a friend to you, and he did not deserve this.  Honor, Tradition and Conviction ran strongly in him.",0);
			add_dialog_str(5,"Now, however, you must retrieve the Aquos Gem from the goblins.",0);
		}
		add_dialog_choice(0,"Amen.");
		wihcaser = run_dialog(1);
		message_dialog("Looking over his corpse, you notice that he was cleaved by a powerful weapon, both sharp and ginormous.","When looking around the goblin camp, you'll look for a weapon capable of such wounds.  It was likely their leader.");
		set_flag(2,1,60);
	}

break;

beginstate 18;

	if(get_flag(2,1) == 60){
		message_dialog("There is a small encampment of goblins here.  They see you coming and decide to attack, as mindless barbarians are wont to do.","");
		create_out_spec_enc(0);
		set_flag(2,1,61);
	}

break;

beginstate 20;

	if(get_flag(2,1) == 61){
		message_dialog("An even larger group of goblins is guarding their village here.  They do not hesitate to charge you.","Oh well, it's their deaths.");
		create_out_spec_enc(1);
		set_flag(2,1,62);
	}

break;

beginstate 19;
	set_out_fight_town_loaded(0);
break;

beginstate 21;

	reset_dialog();
	add_dialog_str(0,"There is a woman selling food here.  Would you like to purchase some?",0);
	add_dialog_choice(0,"No.");
	add_dialog_choice(1,"Yes.");
	buyfood = run_dialog(0);
	if(buyfood == 1){
		block_entry(1);
		end();
	}
	begin_shop_mode("Sarah's Farm","This lady has been working hard at growing crops, and it shows.  Her eatables are of the utmost quality, and the prices are also reasonable beyond a shadow of a doubt.",5,1,-1);
	block_entry(1);

break;